import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'


import fyinyue from './views/FindMusic'
import mymu from './views/MyMusic'
import Paihangbang from './views/child/Ranking'
import Tuijian from './views/child/Recommend'
import Gedan from './views/child/SongList'

import AA from './views/child/mm/aa'
import BB from './views/child/mm/bb'
import CC from './views/child/mm/cc'
Vue.config.productionTip = false
Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: "/foo"
  },
  {
    path: '/foo',
    component: fyinyue,
    children: [{
        path: 'paihang',
        component: Paihangbang,
        children: [{
            path: 'aa',
            component: AA
          },
          {
            path: 'bb',
            component: BB
          }, {
            path: 'cc',
            component: CC
          },




        ]

      },
      {
        path: 'tuijian',
        component: Tuijian
      }, {
        path: 'gedan',
        component: Gedan
      }
    ]

  },
  {
    path: '/mayy',
    component: mymu

  }

]



const router = new VueRouter({
  routes
})
let is = false
router.beforeEach((to, from, next) => {
  if (to.path == '/mayy' && is == false) {
    alert('滚出去')
  } else {
    next()
  }

})
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')